import { request } from "@/api/service";
import { BUTTON_STATUS_NUMBER } from "@/config/button";
import { urlPrefix as complaintsPrefix } from "./api";


export const crudOptions = vm => {
  return {
    pageOptions: {
      compact: true,
      export: {
        local: true,//本地导出，false为服务端导出
      },
    },
    options: {
      tableType: "vxe-table",
      rowKey: true, // 必须设置，true or false
      rowId: "id",
      height: "100%", // 表格高度100%, 使用toolbar必须设置
      highlightCurrentRow: false
    },
    rowHandle: {
      width: 140,
      view: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Retrieve");
        }
      },
      edit: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Update");
        }
      },
      remove: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Delete");
        }
      }
    },
    indexRow: {
      // 或者直接传true,不显示title，不居中
      title: "序号",
      align: "center",
      width: 100
    },
    viewOptions: {
      componentType: "form"
    },
    formOptions: {
      defaultSpan: 24, // 默认的表单 span
      width: "35%"
    },
    columns: [
      {
        title: "ID",
        key: "id",
        show: false,
        disabled: true,
        width: 90,
        form: {
          disabled: true
        }
      },
      {
        title: "受检单位",
        key: "受检单位",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "受检单位必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入受检单位"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "生产企业",
        key: "生产企业",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "生产企业必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入生产企业"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "产品名称",
        key: "产品名称",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "产品名称必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入产品名称"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "规格型号",
        key: "规格型号",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "规格型号必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入规格型号"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "商标",
        key: "商标",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "商标必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入商标"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "生产日期_批号",
        key: "生产日期_批号",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "生产日期_批号必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入生产日期_批号"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "抽样领域",
        key: "抽样领域",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "抽样领域必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入抽样领域"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "不合格项目",
        key: "不合格项目",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "不合格项目必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入不合格项目"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "不合格程度",
        key: "不合格程度",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "不合格程度必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入不合格程度"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "生产企业地址",
        key: "生产企业地址",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "生产企业地址必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入生产企业地址"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "报告编号",
        key: "报告编号",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "报告编号必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入报告编号"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "承检机构",
        key: "承检机构",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "承检机构必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入承检机构"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "辖区",
        key: "辖区",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        search: {
          component: {
            props: {
              clearable: true
            }
          }
        },
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "辖区必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入辖区"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "市局报告签收日期",
        key: "市局报告签收日期",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "市局报告签收日期必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入市局报告签收日期"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "移送转办单",
        key: "移送转办单",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "移送转办单必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入移送转办单"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "市局邮寄日期",
        key: "市局邮寄日期",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "市局邮寄日期必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入市局邮寄日期"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "区局报告签收日期",
        key: "区局报告签收日期",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "区局报告签收日期必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入区局报告签收日期"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "基层所报告签收日期",
        key: "基层所报告签收日期",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "基层所报告签收日期必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入基层所报告签收日期"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "报告送达企业日期",
        key: "报告送达企业日期",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "报告送达企业日期必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入报告送达企业日期"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "汇总表及送达回证上报市局日期",
        key: "汇总表及送达回证上报市局日期",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "汇总表及送达回证上报市局日期必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入汇总表及送达回证上报市局日期"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "责令改正日期",
        key: "责令改正日期",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "责令改正日期必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入责令改正日期"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "组织复查日期",
        key: "组织复查日期",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "组织复查日期必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入组织复查日期"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "复查报告编号",
        key: "复查报告编号",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "复查报告编号必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入复查报告编号"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "复查结果",
        key: "复查结果",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "复查结果必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入复查结果"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "复查单位",
        key: "复查单位",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "复查单位必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入复查单位"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "复查结果送达日期",
        key: "复查结果送达日期",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "复查结果送达日期必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入复查结果送达日期"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "闭环情况(已完成或未完成)",
        key: "闭环情况_已完成或未完成_field",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "闭环情况_已完成或未完成_field必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入闭环情况_已完成或未完成_field"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "备注",
        key: "备注",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "备注必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入备注"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "属地所",
        key: "属地所",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "属地所必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入属地所"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "来源",
        key: "来源",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "input",
        /*search: {
        component: {
            props: {
                clearable: true
            }
        }
        },*/
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "来源必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入来源"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
      {
        title: "统计年份",
        key: "统计年份",
        width: 200,
        sortable: true,
        treeNode: true,

        type: "number",
        search: {
          component: {
            props: {
              clearable: true
            }
          }
        },
        form: {
          editDisabled: true,
          rules: [
            // 表单校验规则
            { required: true, message: "统计年份必填" }
          ],
          component: {
            props: {
              clearable: true
            },
            placeholder: "请输入统计年份"
          },
          itemProps: {
            class: { yxtInput: true }
          }
        }
      },
    ].concat(vm.commonEndColumns())
  };
};
